<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/header_css::header('新增-菜单管理')"></head>
<body>
	<div id="dpLTE" class="container-fluid" v-cloak>
		<ul id="menuTree" class="ztree"></ul>
	</div>
	<div th:include="include/footer_js::footer"></div>
	<script type="text/javascript">
	var setting = {
		data : {
			simpleData : {
				enable : true,
				idKey : "id",
				pIdKey : "parentId",
				rootPId : -1
			},
			key : {
				url : "nourl"
			}
		}
	};
	var ztree;

	var vm = new Vue({
		el : '#dpLTE',
		methods : {
			getMenu : function(menuId) {
				$.get(host+'menu/query', function(r) {
					ztree = $.fn.zTree
							.init($("#menuTree"), setting, r.data);
					var node = ztree.getNodeByParam("id", top.layerForm.vm.menu.parentId);
					if (node){
                        ztree.selectNode(node);
                        top.layerForm.vm.menu.parentName = node.name;
					}
				})
			},
			acceptClick: function() {
				var node = ztree.getSelectedNodes();
				top.layerForm.vm.menu.parentId = node[0].id;
				top.layerForm.vm.menu.parentName = node[0].name;
				dialogClose();
			}
		},
		created : function() {
            $(".basePath").each(function () {
                host=$(this).val();
            });
			this.getMenu();
		}
	})
	</script>
</body>
</html>